def Singleton(cls):
    _instance = {}
    def _wrapper(*args,**kwargs):
        #in 是成员运算符.not in 也是.
        if cls not in _instance:
            _instance[cls] = cls(*args,**kwargs)
        return _instance[cls]
    return _wrapper

@Singleton
class A(object):
    i = 10
    def __init__(self,j):
        self.j = j


a1 = A(20)
a2 = A(30)
print(id(a1))
print(id(a2))



